package com.example.run_game;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
 
import android.app.Activity;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
 
public class ImageLoader {
	
    private Map<ImageView, String> imageViews=Collections.synchronizedMap(new WeakHashMap<ImageView, String>());
 
    public ImageLoader(Context context){
    }
 
    final int stub_id = R.drawable.goat; // *** Change to a no_image file *** //
    
    public void DisplayImage(Context context, String url, ImageView imageView)
    {   	
    	Resources r = context.getResources();
    	if (url!=null)
    	{
     	int drawableId = r.getIdentifier(url, "drawable", "com.example.run_game");
     	imageView.setImageResource(drawableId);
    	}
        else
        {
            imageView.setImageResource(stub_id);
        }
    }
 
}
